package pers.gxm.flyweight;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class BigChar {
    private char charName;
    private String fontData;
    public BigChar(char charName){
        this.charName = charName;
        String fileName = "flyweight/big" + charName + ".txt";
        InputStream resourceAsStream = BigChar.class.getClassLoader().getResourceAsStream(fileName);

        String line;
        StringBuilder sb = new StringBuilder();
        try( BufferedReader br = new BufferedReader(new InputStreamReader(resourceAsStream));){
            while((line = br.readLine()) != null){
                sb.append(line);
                sb.append("\n");
            }
        }catch (IOException e){
            throw new RuntimeException(e);
        }
        this.fontData = sb.toString();
    }

    public void print(){
        System.out.println(fontData);
    }
}
